<%--
  Created by IntelliJ IDEA.
  User: huangzhijian
  Date: 2017/12/29
  Time: 0:26
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>请假统计</title>

    <link rel="stylesheet" type="text/css" href="/css/base.css" />
    <link rel="stylesheet" href="/css/supervise/statistic.css">
    <link rel="stylesheet" href="/lib/layer/skin/default/layer.css">
    <link rel="stylesheet" href="/lib/laydate/need/laydate.css">
    <link rel="stylesheet" type="text/css" href="/lib/pagination/style/pagination.css"/>
    <link rel="stylesheet" type="text/css" href="/css/news/new_news.css"/>
    <link rel="stylesheet" type="text/css" href="/lib/laydate.css"/>
    <link rel="stylesheet" type="text/css" href="/css/news/management_query.css" />
    <%--<link rel="stylesheet" href="/css/workflow/work/automaticNumbering.css">--%>
    <script type="text/javascript" src="/js/news/jquery-1.9.1.js"></script>
    <script src="/js/news/page.js"></script>
    <script src="/js/base/base.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/laydate/laydate.js"></script>
    <%--<script src="../../lib/pagination/js/jquery.pagination.min.js" type="text/javascript" charset="utf-8"></script>--%>
    <script src="/lib/ueditor/ueditor.config.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/ueditor/ueditor.all.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/pagination/js/jquery.pagination.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/layer/layer.js?20201106"></script>
    <script type="text/javascript"  src="/js/base/tablePage.js"></script>
    <!-- word文本编辑器 -->


    <style>
        *{
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        .headtop{
            font-size: 18px;
        }
        .heads{
            float: left;
            font-size: 17pt;
            color: #494d59;
            font-family: Microsoft yahei,Helvetica Neue,Helvetica,PingFang SC,Tahoma,Arial,sans-serif;
            margin-left:30px;
        }
        .switch{
            float: left;
            width:70px;
            font-size:14px;
            line-height: 30px;
            height:30px;
            border-radius:5px;
            background: #2b7fe0;
            color:#ffffff;
            text-align: center;
            margin-right:30px;
            cursor:pointer;
        }
        .img{
            margin:-3px 0px 0px -2px;
        }
        .th{
            padding:10px 5px 10px 0;
        }
        .demand{
            font-size: 16px;
            margin-left:60px ;
            float: left;
        }

        td{
            word-break: break-all;
            width:60px;
        }
        table{
            overflow-x: scroll;
        }

        .pagediv{
            padding: 0 16px;
        }
        .pagediv table tr th{
            border-right: 1px solid #c0c0c0;
            font-size: 13pt;
        }
    </style>
</head>
<body>


<div style="margin-top: 30px;">
    <div class="headtop">

        <div class="demand">
            <select  name="YYYY"  id="year" style="text-align: center"> </select>
            <span><fmt:message code="chat.th.year" /></span>
            <select name="MM" id="month" style="text-align: center"></select>
            <span><fmt:message code="global.lang.month" /></span>
            <span class="switch query" style="float: none;display: inline-block"><fmt:message code="global.lang.query" /></span>
        </div>
        <p  class="add switch">

            导出
        </p>
        <div style="clear:both;"></div>
    </div>


    <div class="pagediv" id="already" style="margin-top:21px;width:100%;">
        <table>
            <thead>
            <tr>
                <th style="width: 6%">姓名</th>
                <th style="width: 6%">年级</th>
                <th style="width: 12%">请假类型</th>
                <th style="width: 14%">请假时间</th>
                <th style="width: 14%">请假天数</th>
                <th style="width: 6%">备注</th>
            </tr>

            </thead>
            <tbody>
            <tr>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
            </tr>
            </tbody>
        </table>




        <div id="dbgz_page" class="M-box3 fr">

        </div>
    </div>

</div>
<script>

    function YYYYMM(){//默认显示查询时间
        var y  = new Date().getFullYear();
        for (var i=(y-5);i<(y+10);i++){
            $('#year').append(new Option(" "+ i ));
        }
        $('#year').val(y);

        for (var i=1;i<13;i++){
            if(i<10){
                i = "0"+i;
            }
            $('#month').append(new Option(" " + i ));
        }
//        $('#month').val = new Date().getMonth() + 1;
        $('#month').val('0'+(new Date().getMonth() + 1))
    }YYYYMM();
    function ajaxData(data1) {
        var ajaxPage={
            data:data1,

            page:function () {
                var me=this;
                $.ajax({
                    type:'post',
                    url:'/attendLeave/queryExportAttends',
                    dataType:'json',
                    data:me.data,
                    success:function(res) {
                        var data=res.obj;
                        var str='';
                        for(var i=0;i<data.length;i++){
                            str+='<tr uid='+data[i].uid+'>' +
                                '<td>'+data[i].userName+'</td><td>'+data[i].deptName+'</td><td>'+data[i].leaveType2+'</td><td>'+data[i].leavesDate1+'</td>' +
                                '<td>'+data[i].number+'</td><td>'+" "+'</td>' +
                                '</tr>'
                        }
                        $('#already tbody').html(str);
                        me.pageTwo(res.totleNum,me.data.pageSize,me.data.page)
                    }
                })

            },
            pageTwo:function (totalData, pageSize,indexs) {//设置分页
                var mes=this;
                $('#dbgz_page').pagination({
                    totalData: totalData,
                    showData: pageSize,
                    jump: true,
                    coping: true,
                    homePage:'',
                    endPage: '',
                    current:indexs||1,
                    callback: function (index) {

                        mes.data.page=index.getCurrent();
                        mes.page();
                    }
                });
            }
        }
        ajaxPage.page();
    }
    $(function () {
        var data1={
            page:1,//当前处于第几页
            pageSize:10,//一页显示几条
            useFlag:true,
            beginDate:$("#year").val()+"-"+$("#month").val()
        }
        ajaxData(data1);
        $('.add').click(function () {//导出
            window.location.href = "/attendLeave/queryExportAttends?beginDate="+$("#year").val()+"-"+$("#month").val()+"&isExport=yes"
        });


        $('.query').click(function(){
            var bshead=$('#year').val()+'-'+$('#month').val();
            data1.beginDate=bshead
            ajaxData(data1);
        })

    })
</script>


</body>
</html>